﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.FieldMultiChoice", ServerTypeId="{284c160f-3783-4344-a471-80e032719f26}")]
    public class FieldMultiChoice : Field
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public FieldMultiChoice(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "FillInChoice"))
                {
                    if (str == "Choices")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Choices"] = reader.ReadStringArray();
                        return flag;
                    }
                    if (str == "Mappings")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Mappings"] = reader.ReadString();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["FillInChoice"] = reader.ReadBoolean();
            }
            return flag;
        }

        [Remote]
        public string[] Choices
        {
            get
            {
                base.CheckUninitializedProperty("Choices");
                return (string[]) base.ObjectData.Properties["Choices"];
            }
            set
            {
                base.ObjectData.Properties["Choices"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Choices", value));
                }
            }
        }

        [Remote]
        public bool FillInChoice
        {
            get
            {
                base.CheckUninitializedProperty("FillInChoice");
                return (bool) base.ObjectData.Properties["FillInChoice"];
            }
            set
            {
                base.ObjectData.Properties["FillInChoice"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "FillInChoice", value));
                }
            }
        }

        [Remote]
        public string Mappings
        {
            get
            {
                base.CheckUninitializedProperty("Mappings");
                return (string) base.ObjectData.Properties["Mappings"];
            }
        }
    }
}

